/* React Query Demo 样式 */
.react-query-demo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* 头部样式 */
.demo-header {
  text-align: center;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.demo-header h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.demo-header p {
  margin: 0;
  font-size: 1.1rem;
  color: #666;
}

/* 导航样式 */
.demo-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.demo-nav button {
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.demo-nav button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.demo-nav button.active {
  background: white;
  color: #667eea;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 内容区域 */
.demo-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

/* 用户管理部分 */
.user-section {
  animation: fadeIn 0.5s ease-in;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
  margin: 0;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fetching {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.section-header button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #667eea;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.section-header button:hover:not(:disabled) {
  background: #5a6fd8;
  transform: translateY(-1px);
}

.section-header button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 搜索框 */
.search-box {
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.searching {
  color: #667eea;
  font-size: 0.9rem;
}

/* 创建表单 */
.create-form {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
  border: 1px solid #e9ecef;
}

.create-form h3 {
  margin: 0 0 15px 0;
  color: #495057;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.form-row input {
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.3s ease;
}

.form-row input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-row button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #28a745;
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.form-row button:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-1px);
}

.form-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 用户网格 */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.user-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
}

.user-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-bottom: 15px;
  border: 3px solid #f8f9fa;
}

.large-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 20px;
  border: 4px solid #f8f9fa;
}

.user-info h4 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.2rem;
}

.user-info p {
  margin: 4px 0;
  color: #666;
  font-size: 0.9rem;
}

.user-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.user-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 60px;
}

.user-actions button:first-child {
  background: #007bff;
  color: white;
}

.user-actions button:first-child:hover:not(:disabled) {
  background: #0056b3;
}

.user-actions button:nth-child(2) {
  background: #ffc107;
  color: #212529;
}

.user-actions button:nth-child(2):hover:not(:disabled) {
  background: #e0a800;
}

.delete-btn {
  background: #dc3545 !important;
  color: white !important;
}

.delete-btn:hover:not(:disabled) {
  background: #c82333 !important;
}

.user-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.modal-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-header button:hover {
  background: #e9ecef;
  color: #333;
}

.user-details {
  padding: 30px;
  text-align: center;
}

.user-details h4 {
  margin: 0 0 20px 0;
  font-size: 1.5rem;
  color: #333;
}

.user-details p {
  margin: 10px 0;
  font-size: 1rem;
  color: #666;
}

/* 编辑表单 */
.edit-form {
  padding: 20px;
}

.edit-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

.edit-form input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.form-actions button[type="button"] {
  background: #6c757d;
  color: white;
}

.form-actions button[type="button"]:hover {
  background: #545b62;
}

.form-actions button[type="submit"] {
  background: #007bff;
  color: white;
}

.form-actions button[type="submit"]:hover:not(:disabled) {
  background: #0056b3;
}

.form-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 文章列表部分 */
.posts-section {
  animation: fadeIn 0.5s ease-in;
}

.posts-section h2 {
  margin: 0 0 25px 0;
  color: #333;
  text-align: center;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.post-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.post-card h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.3rem;
}

.post-content {
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.post-meta {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: #888;
  flex-wrap: wrap;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.load-more-btn {
  display: block;
  margin: 0 auto;
  padding: 12px 30px;
  border: none;
  border-radius: 25px;
  background: #667eea;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.load-more-btn:hover:not(:disabled) {
  background: #5a6fd8;
  transform: translateY(-2px);
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.no-more {
  text-align: center;
  color: #888;
  font-style: italic;
  padding: 20px;
}

/* 查询状态部分 */
.query-status {
  animation: fadeIn 0.5s ease-in;
}

.query-status h2 {
  margin: 0 0 25px 0;
  color: #333;
  text-align: center;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.status-item {
  background: white;
  border-radius: 8px;
  padding: 15px;
  border-left: 4px solid #ddd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.status-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.status-item.success {
  border-left-color: #28a745;
}

.status-item.loading {
  border-left-color: #ffc107;
}

.status-item.error {
  border-left-color: #dc3545;
}

.status-item.idle {
  border-left-color: #6c757d;
}

.query-key {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.85rem;
  background: #f8f9fa;
  padding: 5px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  word-break: break-all;
}

.query-state {
  font-weight: 500;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.query-time {
  font-size: 0.85rem;
  color: #666;
}

.cache-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.cache-actions button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.cache-actions button:first-child {
  background: #17a2b8;
  color: white;
}

.cache-actions button:first-child:hover {
  background: #138496;
}

.cache-actions button:last-child {
  background: #dc3545;
  color: white;
}

.cache-actions button:last-child:hover {
  background: #c82333;
}

/* 底部 */
.demo-footer {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.demo-footer p {
  margin: 5px 0;
  color: white;
  font-size: 0.9rem;
}

/* 加载和错误状态 */
.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
  color: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.loading::before {
  content: '⏳';
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.error {
  text-align: center;
  padding: 20px;
  background: #f8d7da;
  color: #721c24;
  border-radius: 8px;
  border: 1px solid #f5c6cb;
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .react-query-demo {
    padding: 10px;
  }
  
  .demo-header {
    padding: 20px;
  }
  
  .demo-header h1 {
    font-size: 2rem;
  }
  
  .demo-nav {
    flex-direction: column;
    align-items: center;
  }
  
  .demo-nav button {
    width: 200px;
  }
  
  .demo-content {
    padding: 20px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .users-grid {
    grid-template-columns: 1fr;
  }
  
  .user-actions {
    flex-direction: column;
  }
  
  .user-actions button {
    flex: none;
  }
  
  .post-meta {
    flex-direction: column;
    gap: 10px;
  }
  
  .status-grid {
    grid-template-columns: 1fr;
  }
  
  .cache-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .cache-actions button {
    width: 200px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .demo-header h1 {
    font-size: 1.5rem;
  }
  
  .section-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
}